package behaviour.building;

import agent.BuildingAgent;
import jade.core.behaviours.CyclicBehaviour;
import jade.lang.acl.ACLMessage;
import jade.lang.acl.MessageTemplate;

public class ReceiveClearOldPosBehaviour extends CyclicBehaviour {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3674046985568541185L;
	
	private BuildingAgent agent;

	@Override
	public void action() {
		MessageTemplate mt = MessageTemplate.MatchConversationId("clear-position");
		ACLMessage msg = myAgent.receive(mt);
		if(msg != null) {
			agent = (BuildingAgent) myAgent;
			agent.clearPos();
		}
		else
			block();

	}
	
}
